
#pragma once

#include "config.hpp"

template <typename T>
class AccessTest : public ::testing::Test 
{};

TYPED_TEST_CASE_P(AccessTest);

TYPED_TEST_P(AccessTest, Front)
{
    using T1 = TYPE_PARAM<char, long, int>::front;
    using T2 = TYPE_PARAM<long, char, int>::front;

    EXPECT_SAME( char, T1 );
    EXPECT_SAME( long, T2 );
}

TYPED_TEST_P(AccessTest, Back)
{
    using T1 = TYPE_PARAM<char, long, int>::back;
    using T2 = TYPE_PARAM<long, int, char>::back;

    EXPECT_SAME( int,  T1 );
    EXPECT_SAME( char, T2 );
}

TYPED_TEST_P(AccessTest, At_OneElement)
{
    using T1 = TYPE_PARAM<int> ::template at<0>;
    using T2 = TYPE_PARAM<long>::template at<0>;
    using T3 = TYPE_PARAM<char>::template at<0>;

    EXPECT_SAME( int , T1 );
    EXPECT_SAME( long , T2 );
    EXPECT_SAME( char , T3 );
}

TYPED_TEST_P(AccessTest, At)
{
    using T1 = TYPE_PARAM<int, long, char>  ::template at<1>;
    using T2 = TYPE_PARAM<long, int, char>  ::template at<2>;
    using T3 = TYPE_PARAM<char, size_t, int>::template at<2>;

    EXPECT_SAME( long, T1 );
    EXPECT_SAME( char, T2 );
    EXPECT_SAME( int, T3 );
}

REGISTER_TYPED_TEST_CASE_P(AccessTest, Front, Back,
                           At_OneElement, At);
